package com.ithong.mp.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.ithong.mp.enums.SexEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
//@TableName("tb_user")
public class User extends Model<User> {

    @TableId(type = IdType.AUTO)
    private Long id;
    private String userName;

    //插入数据时进行填充
    @TableField(select = false,fill = FieldFill.INSERT)//查询时不返回字段的值
    private String password;
    private String name;
    private Integer age;

    @TableField(value = "email")
    //指定数据库表中字段名
    private String mail;

    @TableField(exist = false)
    private String address;//在数据库中不存在

    @Version //乐观锁版本
    private Integer version;

    @TableLogic //逻辑删除字段:1删除；0：未删除
    private Integer deleted;

    private SexEnum sex;
}